#pragma once

#include "IOgreManager.h"
#include <OgreRoot.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include "GameServices.h"
#include "IGameEngine.h"

class OgreManager : public IOgreManager{
	friend class GameEngine;
public:
	Ogre::Root* GetRoot()									{return _root;}
	Ogre::RenderWindow* GetRenderWindow()					{return _window;}
	
	Ogre::SceneManager* GetSceneManager()					{return _sceneMgr;}
	Ogre::Camera* GetCamera()								{return _camera;}

	void SetSceneManager(Ogre::SceneManager* sceneMgr)		{_sceneMgr = sceneMgr;}
	void SetCamera(Ogre::Camera* camera)					{_camera = camera;}

	Ogre::String GetPluginsConfig()							{return _pluginsConfig;}
	Ogre::String GetResourcesConfig()						{return _resourcesConfig;}
	
	static IOgreManager* getSingleton(){
		if(!_ogreManager)
			_ogreManager = new OgreManager();
		return _ogreManager;
	}

protected:
	static IOgreManager* _ogreManager;

	OgreManager();
	~OgreManager(){}

	void Initialize();
	void UpdateStarted(const Ogre::FrameEvent& gameTime);
	void UpdateEnded(const Ogre::FrameEvent& gameTime);
	void Cleanup();

	Ogre::Root* _root;
	Ogre::SceneManager* _sceneMgr;
	Ogre::RenderWindow* _window;
	Ogre::Camera* _camera;
	Ogre::String _pluginsConfig;
	Ogre::String _resourcesConfig;
};